package com.itheima.zy;


import java.util.Random;

public class Test14 {
    public static void main(String[] args) {

        //需求：自动生成五个整数数据，分别计算他们的，最大值，最小值，数据和，平均值。
        int[] num = new int[10];
        Random random = new Random();


        for (int i = 0; i < num.length; i++) {
//            System.out.println("第"+(i+1)+"数据");
            num[i] = random.nextInt(100) + 1;
            System.out.println(num[i]);
        }
        int sum = 0;
        int max = num[0];
        int min = num[0];
        for (int i = 1; i < num.length; i++) {
            sum += num[i];
            if (num[i] > max) {
                max = num[i];
            } else if (num[i] < min) {
                min = num[i];

            }
        }
        System.out.println("最大值：" + max);
        System.out.println("最小值：" + min);
        System.out.println("总和值：" + sum);
        System.out.println("平均值：" + sum / num.length);


    }
}
